/**
 * 开课资源管理接口
 */
import request from '@/utils/request'
const baseHwQuestionApi = '/course/homework-question'
const baseHomeworkApi = '/course/homework'

// 获取作业题目列表
export function getHwQuestionsByHomework(homeworkId) {
  return request({
    url: `${baseHwQuestionApi}/display`,
    method: 'get',
    params: { homeworkId }
  })
}

// 更新作业题目
export function editQuestion(reqData) {
  return request({
    url: `${baseHwQuestionApi}/editQuestion`,
    method: 'post',
    data: reqData
  })
}

// 新增作业题目
export function addQuestion(reqData) {
  return request({
    url: `${baseHwQuestionApi}/addQuestion`,
    method: 'post',
    data: reqData
  })
}

// 删除作业题目
export function deleteQuestion(reqData) {
  return request({
    url: `${baseHwQuestionApi}/deleteQuestion`,
    method: 'post',
    data: reqData
  })
}

// 获取课程下的所有作业信息
export function listHomeworkByCourse(courseId) {
  return request({
    url: `${baseHomeworkApi}/list`,
    method: 'get',
    params: { courseId }
  })
}

// 按id获取作业信息
export function getHomeworkById(id) {
  return request({
    url: `${baseHomeworkApi}/id`,
    method: 'get',
    params: { id }
  })
}

// 编辑作业信息
export function editHomework(reqData) {
  return request({
    url: `${baseHomeworkApi}/edit`,
    method: 'post',
    data: reqData
  })
}

// 新增作业信息
export function addHomework(reqData) {
  return request({
    url: `${baseHomeworkApi}/create`,
    method: 'post',
    data: reqData
  })
}

// 删除作业信息
export function deleteHomework(id) {
  return request({
    url: `${baseHomeworkApi}/delete`,
    method: 'post',
    params: { id }
  })
}
